package com.zf.apartment.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zf.apartment.mapper.LocationMapper;
import com.zf.apartment.domain.Location;
import com.zf.apartment.service.ILocationService;

/**
 * 位置Service业务层处理
 *
 * @author rxf
 * @date 2024-09-29
 */
@Service
public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> implements ILocationService {
    @Autowired
    private LocationMapper locationMapper;

    /**
     * 查询位置
     *
     * @param locationId 位置主键
     * @return 位置
     */
    @Override
    public Location selectLocationByLocationId(Long locationId) {
        return locationMapper.selectLocationByLocationId(locationId);
    }

    /**
     * 查询位置列表
     *
     * @param location 位置
     * @return 位置
     */
    @Override
    public List<Location> selectLocationList(Location location) {
        return locationMapper.selectLocationList(location);
    }

    /**
     * 新增位置
     *
     * @param location 位置
     * @return 结果
     */
    @Override
    public int insertLocation(Location location) {
            return locationMapper.insertLocation(location);
    }

    /**
     * 修改位置
     *
     * @param location 位置
     * @return 结果
     */
    @Override
    public int updateLocation(Location location) {
        return locationMapper.updateLocation(location);
    }

    /**
     * 批量删除位置
     *
     * @param locationIds 需要删除的位置主键
     * @return 结果
     */
    @Override
    public int deleteLocationByLocationIds(Long[] locationIds) {
        return locationMapper.deleteLocationByLocationIds(locationIds);
    }

    /**
     * 删除位置信息
     *
     * @param locationId 位置主键
     * @return 结果
     */
    @Override
    public int deleteLocationByLocationId(Long locationId) {
        return locationMapper.deleteLocationByLocationId(locationId);
    }

    @Override
    public List<Location> selectLocationListByFlatsId(Long flatsId) {
        return locationMapper.selectLocationListByFlatsId(flatsId);
    }

    @Override
    public Long selectLocationIdByLocationName(String locationName) {
        return locationMapper.selectLocationIdByLocationName(locationName);
    }

    @Override
    public List<Location> selectLocationListByLocationType(String locationType) {
        return locationMapper.selectLocationListByLocationType(locationType);
    }

    public List<Location> selectLocationListByParentId(Long id) {
        return locationMapper.selectLocationListByParentId(id);
    }

    @Override
    public List<Location> selectProvinces() {
        return locationMapper.selectProvinces();
    }

    @Override
    public List<Location> selectCitiesByProvince(Long provinceId) {
        return locationMapper.selectCitiesByProvince(provinceId);
    }

    @Override
    public List<Location> selectAreasByCity(Long cityId) {
        return locationMapper.selectAreasByCity(cityId);
    }
}